home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20030409-20031118
/
000255_fdc@sesame.cc.columbia.edu_Thu Sep 4 10:16:18 EDT 2003.msg
< prev
next >
Wrap
Text File
|
2020-01-01
|
3KB
|
79 lines
Article: 14495 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news-not-for-mail
From: fdc@sesame.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: missing bytes...
Date: 4 Sep 2003 10:16:10 -0400
Organization: Columbia University
Lines: 62
Message-ID: <bj7hfa$1ho$1@sesame.cc.columbia.edu>
References: <cf6cc183.0309031713.73a00933@posting.google.com>
NNTP-Posting-Host: sesame.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1062684971 4299 128.59.59.56 (4 Sep 2003 14:16:11 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 4 Sep 2003 14:16:11 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14495
In article <cf6cc183.0309031713.73a00933@posting.google.com>,
icurmt <icurmtdude@yahoo.com> wrote:
: After no luck with this issue, I thought of posting it here.. Heres
: what I am trying to do..
:
: I am sending out commands out of a file through serial port to my
: application which returns me the response accordingly in return..
:
: <code snippet...>
: ..
: ...
: transmit /binary /noecho /nowait <commandsfile>
: input 1 -1
: .output := \fhexify(\v(input))
: echo \m(output)
: ...
: fopen /write \%c <outputfile>
: ..
: fwrite /line \%c \m(output)
: ..
: fclose \%c
:
: </end>
:
: The script works fine. The response as under is outputted to the
: 'outputfile'. Now when I echo the response I get
:
: 16 06 14 34 47 12 01 87
: instead of
: 16 06 14 34 47 12 00 01 87 00 00 00
:
: Note the difference after the 6th byte. The 7th and 8th byte which is
: 00 01 shows up as 01 and 10th, 11th and 12th bytes do now show up at
: all. However I have had success getting bytes in the order such as
: below and echoing this command works fine.
: 16 06 14 34 46 11 00 00 BB 10 00 00
:
C-Kermit and K95 written in C, in which strings are NUL-terminated.
Thus it is virtually impossible for it to deal with strings that contain
NUL characters -- we would not be able to use C library calls or Unix
system services, all of which require strings to be in this format.
This applies also the INPUT buffer. \v(input) is a string, hence by
definition NUL-terminated. Realizing that it is common to receive NUL
characters on a communication connection as padding and/or part of the
Telnet NVT data stream, the INPUT command discards NULs so the \v(input)
value will not be truncated the first time a NUL arrives.
The only way to deal with NUL characters is on a per-character basis.
If you want to read a series of characters from the connection that can
include NULs, you have to do it using INPUT with no target text. Example:
while (some condition) {
input 1
if fail (do something)
fwrite /char \%c \v(inchar)
}
This works because when \v(inchar) is NUL, that's equivalent to FWRITE /CHAR
having no text argument at all, in which case it writes a NUL character.
- Frank